package com.grad.why.studentsystem.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.grad.why.studentsystem.domain.Classinfo;
import com.grad.why.studentsystem.domain.Project;
import com.grad.why.studentsystem.domain.Student;
import com.grad.why.studentsystem.domain.current.CurrentCourse;
import com.grad.why.studentsystem.mapper.ClassinfoMapper;
import com.grad.why.studentsystem.mapper.ProjectMapper;
import com.grad.why.studentsystem.mapper.StudentMapper;
import com.grad.why.studentsystem.service.ChooseCourseService;
import com.grad.why.studentsystem.service.ClassesTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

@Component
@Service(interfaceClass = ClassesTableService.class)
@Transactional
public class ClassesTableServiceImpl implements ClassesTableService{
    @Autowired
    private ProjectMapper projectMapper;

    @Autowired
    private ClassinfoMapper classinfoMapper;

    @Autowired
    private StudentMapper studentMapper;

    @Override
    public List<Project> getProjects() {
        try{
            return projectMapper.getProjects();
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public List<Classinfo> getClassesByProjectId(Integer id) {
        try{
            return classinfoMapper.getClassInfosByProjectId(id);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public List<Student> getStudentsInfoByClassId(Integer id) {
        try{
            return studentMapper.getStudentsInfoByClassId(id);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
